package com.zhou.api;

import com.zhou.api.entity.Driver;
import com.zhou.service.DriverService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description : 司机信息
 * @Author : zyy
 * @Date: 2024/9/4  17:49
 */
@RestController
@RequestMapping("driver")
@Api(tags = "司机管理")
public class DriverController {
    @Resource
    DriverService driverService;

    /**
     * 添加司机
     * @param driver
     * @return
     */
    @PostMapping("add")
    @Operation(summary = "添加司机")
    public String add(Driver driver) {
        driverService.add(driver);
        return "添加成功";
    }

    /**
     * 修改司机信息
     */
    @PostMapping("update")
    @Operation(summary = "修改司机信息")
    public String update(Driver driver) {
        driverService.update(driver);
        return "修改成功";
    }

    /**
     * 司机状态修改
     */
    @PostMapping("updateDelFlag")
    @Operation(summary = "司机状态修改")
    public String updateDelFlag(@RequestParam String id,@RequestParam Integer delFlag) {
        driverService.updateDelFlag(id, delFlag);
        return "修改成功";
    }
}
